﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace AGameOfThrones.units
{
    /// <summary>
    /// Interaction logic for units.xaml
    /// </summary>
    public partial class units : UserControl
    {

        public Panel Panel { get { return units_panel; } }

        public units()
        {
            InitializeComponent();
        }

        private void units_control_Loaded(object sender, RoutedEventArgs e)
        {
            game.house h = this.DataContext as game.house;
            if (h != null)
            {
                for (int i = 0; i < h.Units.Count; i++)
                {
                    game.unit p = h.Units[i];
                    piece.piece t = new piece.piece();
                    t.DataContext = p;
                    t.PieceName = p.PieceName;
                    units_panel.Children.Add(t);
                }
            }
        }
    }
}
